[Case Shaing] Add Mailbox Role to a CAS failed with error "Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)"

After you install any server roles on a computer running Exchange 2013, you can't use the Exchange 2013 Setup wizard to add any additional server roles to this computer. If you want to add more server roles to a computer, you must either use Add or Remove Programs from Control Panel or use Setup.exe from a Command Prompt window.

Checking the setup log, you can find the following error messages:

[05/13/2015 16:25:29.0082] [2] Active Directory session settings for 'New-OwaVirtualDirectory' are: View Entire Forest: 'True', Configuration Domain Controller: 'DOMAINCONTROLLER.DOMAIN.DOMAIN', Preferred Global Catalog: 'DOMAINCONTROLLER.DOMAIN.DOMAIN', Preferred Domain Controllers: '{ DOMAINCONTROLLER.DOMAIN.DOMAIN }'

[05/13/2015 16:25:29.0082] [2] User specified parameters:  -Role:'Mailbox' -WebSiteName:'Exchange Back End' -DomainController:'DOMAINCONTROLLER.DOMAIN.DOMAIN'

[05/13/2015 16:25:29.0082] [2] Beginning processing new-OwaVirtualDirectory

[05/13/2015 16:25:29.0222] [2] Searching objects "SERVERNAME.DOMAIN.DOMAIN" of type "Server" under the root "$null".

[05/13/2015 16:25:29.0269] [2] Previous operation run on domain controller 'DOMAINCONTROLLER.DOMAIN.DOMAIN'.

[05/13/2015 16:25:29.0285] [2] Processing object "SERVERNAME\owa".

[05/13/2015 16:25:33.0050] [2] [ERROR] An error occurred while creating the IIS virtual directory 'IIS://SERVERNAME.DOMAIN.DOMAIN/W3SVC/2/ROOT/owa' on 'SERVERNAME'.

[05/13/2015 16:25:33.0050] [2] [ERROR] Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)

[05/13/2015 16:25:33.0050] [2] [ERROR] An error occurred while creating the IIS virtual directory 'IIS://SERVERNAME.DOMAIN.DOMAIN/W3SVC/2/ROOT/owa' on 'SERVERNAME'.

[05/13/2015 16:25:33.0050] [2] [ERROR] Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)

[05/13/2015 16:25:33.0066] [2] Ending processing new-OwaVirtualDirectory

[05/13/2015 16:25:33.0082] [2] Active Directory session settings for 'Set-OwaVirtualDirectory' are: View Entire Forest: 'True', Configuration Domain Controller: 'DOMAINCONTROLLER.DOMAIN.DOMAIN', Preferred Global Catalog: 'DOMAINCONTROLLER.DOMAIN.DOMAIN', Preferred Domain Controllers: '{ DOMAINCONTROLLER.DOMAIN.DOMAIN }'

[05/13/2015 16:25:33.0082] [2] User specified parameters:  -Identity:'SERVERNAME\OWA (Exchange Back End)' -FormsAuthentication:'False' -WindowsAuthentication:'True'

[05/13/2015 16:25:33.0082] [2] Beginning processing set-OwaVirtualdirectory

[05/13/2015 16:25:33.0082] [2] Searching objects "SERVERNAME\OWA (Exchange Back End)" of type "ADOwaVirtualDirectory" under the root "$null".

[05/13/2015 16:25:33.0082] [2] Previous operation run on domain controller 'DOMAINCONTROLLER.DOMAIN.DOMAIN'.

[05/13/2015 16:25:33.0082] [2] [ERROR] The operation couldn't be performed because object 'SERVERNAME\OWA (Exchange Back End)' couldn't be found on 'DOMAINCONTROLLER.DOMAIN.DOMAIN'.

[05/13/2015 16:25:33.0097] [2] Ending processing set-OwaVirtualdirectory

Based on the ExchangeSetup.log, it indicate that the OWA Virtual Directory has already exist on SERVERNAME.

Then run below command to double check OWA VD:

Get-OwaVirtualDirectory -ShowMailboxVirtualDirectories | FL Identity,Server,MetabasePath,Path,*URL*,*Domain*,Website

Note: The ShowMailboxVirtualDirectories switch specifies whether the OWA virtual directories on Mailbox servers are returned. More details about this parameter please refer to Get-OwaVirtualDirectory.

The difference in Exchange 2013 is that, it has got 2 websites hosted at IIS (Default Website and Exchange Back End). More details you can find in below blog: Managing Exchange 2013 IIS Virtual Directories & Web Applications.

By default, the Virtual Directory of Exchange Back End site only exist on server which install Mailbox role. If there have a relevant VD in only CAS server, it could return above error when add Mailbox role in it.

Therefore, we can use below command to remove this redundant Virtual Directory.

Remove-OwaVirtualDirectory ServerName\owa (exchange back end)

Meanwhile, run IIS \reset to refresh IIS then run the Exchange setup.exe again as Administrator to add Mailbox role.

The above solution can also apply for the following error message:

$feVdirName = "PowerShell (Default Web Site)";
$beVdirName = "PowerShell (Exchange Back End)";
$vdirName = "PowerShell";
$InternalPowerShellUrl="http://" + $RoleFqdnOrName + "/powershell";

Get-PowerShellVirtualDirectory -ShowMailboxVirtualDirectories -server $RoleFqdnOrName -DomainController $RoleDomainController | where { $_.Name -eq $beVdirName -or $_.Name -eq $feVdirName } | remove-PowerShellVirtualDirectory -DomainController $RoleDomainController;

New-PowerShellVirtualDirectory $vdirName -Role Mailbox -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$true -RequireSSL:$true -WebSiteName "Exchange Back End" -Path ($RoleInstallPath + "ClientAccess\PowerShell-Proxy");

New-PowerShellVirtualDirectory $vdirName -Role Mailbox -InternalUrl $InternalPowerShellUrl -DomainController $RoleDomainController -BasicAuthentication:$false -WindowsAuthentication:$false -RequireSSL:$false -WebSiteName "Default Web Site" -AppPoolId "MSExchangePowerShellFrontEndAppPool"; " was run: "The virtual directory 'PowerShell' already exists under 'server01.XXXXX.local/Exchange Back End'.

May 31st, 2015 5:31am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics